package cn.wolfcode.controller;


import cn.wolfcode.entity.Banner;
import cn.wolfcode.entity.Strategy;
import cn.wolfcode.service.IBannerService;
import cn.wolfcode.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author c1eye
 * @since 2022-11-03
 */
@RestController
@CrossOrigin
@RequestMapping("/banners")
public class BannerController {

    @Autowired
    private IBannerService bannerService;

    @GetMapping("/strategy")
    public JSONResult strategy() {
        List<Banner> list = bannerService.queryByType(1);
        return JSONResult.success(list);
    }

    @GetMapping("/travel")
    public JSONResult travel() {
        List<Banner> banners = bannerService.queryByType(2);
        return JSONResult.success(banners);
    }
}

